//
//  BaseInfoViewMode.m
//  fitness-iOS
//
//  Created by 卢仕彤 on 2018/1/5.
//  Copyright © 2018年 卢仕彤. All rights reserved.
//

#import "BaseInfoViewMode.h"
#import "UIImageView+RoundImage.h"
#import "UIImageView+WebCache.h"

@implementation BaseInfoViewMode

@end


@interface BaseHeadCell ()
@property (nonatomic, strong) UIImageView *iconImageView;
@end

@implementation BaseHeadCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initView];
    }
    return self;
}

- (void)initView {
    [self.contentView addSubview:self.iconImageView];
    NSString *info_url_syring = @"http://touchfit.oss-cn-qingdao.aliyuncs.com/headimg/14/%E5%A4%B4%E5%83%8F.png";
    [self.iconImageView ff_setImageUrl:[NSURL URLWithString:info_url_syring] placeholder:[UIImage imageNamed:@"img_personal_head"] size:CGSizeMake(80, 80) cornerRadius:40 borderWidth:0 borderColor:@"#FFFFFF"];
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.centerY);
        make.centerX.equalTo(self.contentView.centerX).offset(-10);
        make.size.equalTo(CGSizeMake(80, 80));
    }];
}

- (UIImageView *)iconImageView {
    if (!_iconImageView) {
        _iconImageView = [[UIImageView alloc] init];
    }
    return _iconImageView;
}
@end

@interface BaseDeatilsCell ()
@property (nonatomic, strong) UIImageView *rightImageView;
@end

@implementation BaseDeatilsCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initView];
    }
    return self;
}

- (void)initView {
    [self.contentView addSubview:self.leftBaseLabel];
    [self.leftBaseLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.left).offset(30);
        make.centerY.equalTo(self.contentView.centerY);
    }];
    
    
    [self.contentView addSubview:self.rightImageView];
    [_rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.right.equalTo(self.contentView.mas_right).offset(-15);
        make.size.mas_equalTo(CGSizeMake(22, 22));
    }];
    
    [self.contentView addSubview:self.rightBaseLabel];
    [self.rightBaseLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.rightImageView.left).offset(-10);
        make.centerY.equalTo(self.contentView.centerY);
    }];
    
    
    
    UIView *lineView = [UIView new];
    [self.contentView addSubview:lineView];
    lineView.backgroundColor = [UIColor colorWithHexString:@"#E7E7E7"];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.left).offset(30);
        make.right.equalTo(self.contentView.right);
        make.bottom.equalTo(self.contentView.bottom);
        make.height.equalTo(@(0.5));
    }];
}

- (UILabel *)leftBaseLabel {
    if (!_leftBaseLabel) {
        _leftBaseLabel = [UILabel labelWithSystemFontSize:15 textColorHexString:@"#333333"];
    }
    return _leftBaseLabel;
}

- (UILabel *)rightBaseLabel {
    if (!_rightBaseLabel) {
        _rightBaseLabel = [UILabel labelWithSystemFontSize:15 textColorHexString:@"#FF8C00"];
    }
    return _rightBaseLabel;
}

- (UIImageView *)rightImageView {
    if (!_rightImageView) {
        _rightImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"right_arrow"]];
        _rightImageView.contentMode = UIViewContentModeCenter;
    }
    return _rightImageView;
}

@end


